{% extends "smErp/base.html" %}

{% block css_style %}
    {% load staticfiles %}
    <link href="{% static 'smErp/css/brand_info.css' %}" type="text/css" rel="stylesheet">
    <link href="{% static 'smErp/assets/dropzone/basic.min.css' %}" type="text/css" rel="stylesheet">
    <link href="{% static 'smErp/assets/dropzone/dropzone.min.css' %}" type="text/css" rel="stylesheet">

{% endblock %}

{% block content %}
    <div class="inner wrp">
        <div class="page_nav">
            <a href="javascript:void(0);" class="jsUrlLink" data-url="home/index" target="_self">首页</a>
            <span class="gap">/</span>
            错误信息
        </div>
        <div class="container_box cell_layout">
            <div class="forget_box type" id="step1">
                <div class="page_msg default simple">
                    <div class="inner">
                        <div class="msg_content">
                            <p style="margin-top: 150px; text-align: center;">
                            {% if msg_error %}
                                错误信息 : {{ msg_error }}
                            {% else %}
                                提交的信息错误
                            {% endif %}
                                <a href="{% url "smErp:index" %}" class="unline-a" style="color: #7fba4f">返回首页</a>
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}

{% block footscript %}
    <script>
        // 重新填写
        $("#rewrite").on("click", function(){
            $("#emailTxt").html("");
            $("#step2").hide();
            $("#step1").show();
        });

        // 请求下发忘记密码邮件
        $("#okBt").on("click", function(){
            var email = $("#email").val();
            if(!email){
                layer.msg("请输入邮箱地址");
                return;
            }else{
                if(!check_email(email)){
                   layer.msg("请输入正确格式的邮箱地址");
                    return;
                }
            }
            var params = $("#form").serialize();
            $.ajax({
                type: 'POST',
                url: '{% url "smErp:forget_password" %}',
                data: params,
                dataType: 'json',
                success: function(data){
                    if (data.result == 0) {
                        // 成功显示成功
{#                        layer.msg("重新发送邮件成功");#}
                        $("#emailTxt").html(email);
                        $("#step1").hide();
                        $("#step2").show();
                    } else {
                        //提示层
                        layer.msg(data.reason);
                    }
                }
            });
        });
    </script>
{% endblock %}




